package com.bluejie.bluej.java.design.proxy;

/**
 * Created by bluej on 2018-03-06.
 */
public class Demo {
    public static void main(String[] args) {
        MyProxy1();
        //MyProxy2();

    }
    private static void MyProxy1(){
        ProductService productService =(ProductService) new MyProxy1().getInstance(new ProductServiceImpl());
        String name = productService.getProductName();
        System.out.println("--name:"+name);
    }
    private static void MyProxy2(){
        ProductService productService = MyProxy2.getInstance(new ProductServiceImpl());
        String name = productService.getProductName();
        System.out.println("--name:"+name);
    }
}
